//
//  WZGAplyFillInfomationOneCell.m
//  ZCJZ
//
//  Created by 潘洪波 on 2020/2/27.
//  Copyright © 2020 jeking. All rights reserved.
//

#import "WZGAplyFillInfomationOneCell.h"
#import <UILabel+Flex.h>
#import <UIImageView+WebCache.h>
@interface WZGAplyFillInfomationOneCell ()

@property (nonatomic, strong) UIImageView *idCardImg ;
@property (nonatomic, strong) UILabel *titleLab ;

@end


@implementation WZGAplyFillInfomationOneCell

- (instancetype)initWithFlex:(NSString *)flexName reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithFlex:flexName reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.idCardImg setUserInteractionEnabled:YES];
//        self.idCardImg.image = [UIImage imageNamed:@""];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addImgTap)];
        [self.idCardImg addGestureRecognizer:tap];
    }
    return self;
}

- (void)setPlaceholderImg:(UIImage *)placeholderImg{
    _placeholderImg = placeholderImg;
    self.idCardImg.image = placeholderImg;
}

- (void)setCerImg:(NSString *)cerImg{
    if (cerImg) {
        [self.idCardImg sd_setImageWithURL:[NSURL URLWithString:cerImg] placeholderImage:self.placeholderImg options:SDWebImageAllowInvalidSSLCertificates];
    }else{
        self.idCardImg.image = self.placeholderImg;
    }
}

- (void)addImgTap{
    if (self.imageTaped) {
        self.imageTaped();
    }
}

- (void)setTitle:(NSString *)title{
    _title = title;
    [self.titleLab setFlexAttrString:title name:@"des"];
    [self.titleLab updateAttributeText];
}

- (void)setHideActionText:(bool)hideActionText{
    _hideActionText = hideActionText;
    [self.titleLab setFlexAttrString:hideActionText?@"":@"点击上传" name:@"a"];
    [self.titleLab setFlexAttrString:@"" name:@"des"];
    [self.titleLab updateAttributeText];
    if (hideActionText) {
        self.titleLab.text = self.title;
    }
}
@end
